<?php

namespace app\modules\clinical\models;

use Yii;

/**
 * This is the model class for table "excel_pfbc".
 *
 * @property integer $pk_id
 * @property integer $pt_age
 * @property string $pt_history
 * @property integer $bd_jili_lu
 * @property integer $bd_jiz_lu
 * @property integer $bd_jiz_ld
 * @property integer $bd_jiz_ru
 * @property integer $bd_jiz_rd
 * @property integer $bd_jili_ld
 * @property integer $bd_jili_ru
 * @property integer $bd_jili_rd
 * @property integer $bd_fanshe_er
 * @property integer $bd_fanshe_san
 * @property integer $bd_fanshe_rao
 * @property integer $bd_fanshe_xi
 * @property integer $bd_fanshe_huai
 * @property integer $bd_zhen_bin
 * @property integer $bd_zhen_huai
 * @property integer $bd_bingli
 * @property integer $bd_hoffman
 * @property integer $bd_zhangai
 * @property string $bd_zhuiti
 * @property integer $bd_gg_zhibi
 * @property integer $bd_gg_genxi
 * @property integer $bd_gg_romberg
 * @property integer $bd_gg_yizi
 * @property string $bd_shenjing
 * @property integer $bd_weisuo_ji
 * @property integer $bd_gongxing
 * @property integer $bd_butai
 * @property integer $bd_gouyin
 * @property integer $bd_shiyu
 * @property integer $bd_yanzhen
 * @property string $bd_pifu
 * @property string $bd_fayu
 * @property string $lc_yd_parkinson
 * @property string $lc_yd_dance
 * @property string $lc_yd_zhench
 * @property string $lc_yd_jiz
 * @property string $lc_yd_shouz
 * @property string $lc_yd_koum
 * @property string $lc_sj_zhengz
 * @property string $lc_sj_yiyu
 * @property string $lc_sj_renzhi
 * @property string $lc_sj_xinge
 * @property string $lc_else_butai
 * @property string $lc_else_yanyu
 * @property string $lc_else_xiaon
 * @property string $lc_else_xian
 * @property string $lc_else_zhui
 * @property string $lc_else_gan
 * @property string $lc_else_wei
 * @property string $lc_else_mi
 * @property string $lc_else_jiz
 */
class ExcelPfbc extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'excel_pfbc';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['pt_age', 'bd_jili_lu', 'bd_jiz_lu', 'bd_jiz_ld', 'bd_jiz_ru', 'bd_jiz_rd', 'bd_jili_ld', 'bd_jili_ru', 'bd_jili_rd', 'bd_fanshe_er', 'bd_fanshe_san', 'bd_fanshe_rao', 'bd_fanshe_xi', 'bd_fanshe_huai', 'bd_zhen_bin', 'bd_zhen_huai', 'bd_bingli', 'bd_hoffman', 'bd_zhangai', 'bd_gg_zhibi', 'bd_gg_genxi', 'bd_gg_romberg', 'bd_gg_yizi', 'bd_weisuo_ji', 'bd_gongxing', 'bd_gouyin', 'bd_shiyu', 'bd_yanzhen', 'lc_yd_parkinson', 'lc_yd_dance', 'lc_yd_zhench', 'lc_yd_jiz', 'lc_yd_shouz', 'lc_yd_koum', 'lc_sj_zhengz', 'lc_sj_yiyu', 'lc_sj_renzhi', 'lc_sj_xinge', 'lc_else_butai', 'lc_else_yanyu', 'lc_else_xiaon', 'lc_else_xian', 'lc_else_zhui', 'lc_else_gan', 'lc_else_wei', 'lc_else_mi', 'lc_else_jiz'], 'required'],
            [['pt_age', 'bd_jili_lu', 'bd_jiz_lu', 'bd_jiz_ld', 'bd_jiz_ru', 'bd_jiz_rd', 'bd_jili_ld', 'bd_jili_ru', 'bd_jili_rd', 'bd_fanshe_er', 'bd_fanshe_san', 'bd_fanshe_rao', 'bd_fanshe_xi', 'bd_fanshe_huai', 'bd_zhen_bin', 'bd_zhen_huai', 'bd_bingli', 'bd_hoffman', 'bd_zhangai', 'bd_gg_zhibi', 'bd_gg_genxi', 'bd_gg_romberg', 'bd_gg_yizi', 'bd_weisuo_ji', 'bd_gongxing', 'bd_gouyin', 'bd_shiyu', 'bd_yanzhen'], 'integer'],
            [['pt_history', 'bd_butai', 'bd_zhuiti', 'bd_shenjing', 'bd_pifu', 'bd_fayu', 'lc_yd_parkinson', 'lc_yd_dance', 'lc_yd_zhench', 'lc_yd_jiz', 'lc_yd_shouz', 'lc_yd_koum', 'lc_sj_zhengz', 'lc_sj_yiyu', 'lc_sj_renzhi', 'lc_sj_xinge', 'lc_else_butai', 'lc_else_yanyu', 'lc_else_xiaon', 'lc_else_xian', 'lc_else_zhui', 'lc_else_gan', 'lc_else_wei', 'lc_else_mi', 'lc_else_jiz'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'pk_id' => 'Pk ID',
            'pt_age' => '发病年龄',
            'pt_history' => '现病史',
            'bd_jiz_lu' => '左上肢',
            'bd_jiz_ld' => '左下肢',
            'bd_jiz_ru' => '右上肢',
            'bd_jiz_rd' => '右下肢',
            'bd_jili_lu' => '左上肢',
            'bd_jili_ld' => '左下肢',
            'bd_jili_ru' => '右上肢',
            'bd_jili_rd' => '右下肢',
            'bd_fanshe_er' => '肱二头肌反射',
            'bd_fanshe_san' => '肱三头肌反射',
            'bd_fanshe_rao' => '桡骨膜',
            'bd_fanshe_xi' => '膝反射',
            'bd_fanshe_huai' => '踝反射',
            'bd_zhen_bin' => '髌阵挛',
            'bd_zhen_huai' => '踝阵挛',
            'bd_bingli' => '病理征',
            'bd_hoffman' => 'Hoffman征',
            'bd_zhangai' => '感觉障碍（有无痛触觉障碍）',
            'bd_zhuiti' => '锥体外系',
            'bd_gg_zhibi' => '指鼻试验',
            'bd_gg_genxi' => '跟膝胫试验',
            'bd_gg_romberg' => 'Romberg征',
            'bd_gg_yizi' => '一字步',
            'bd_shenjing' => '植物神经功能检查（有无大小便障碍）',
            'bd_weisuo_ji' => '肌萎缩（近端及远端）',
            'bd_gongxing' => '弓形足',
            'bd_butai' => '步态',
            'bd_gouyin' => '构音障碍',
            'bd_shiyu' => '失语',
            'bd_yanzhen' => '眼震',
            'bd_pifu' => '皮肤病变',
            'bd_fayu' => '生长发育有无异常（骨骼、脊柱、手指）',
            'lc_yd_parkinson' => '帕金森症（对掌运动、握拳运动、踏脚跟（脚尖脚跟交替）、行走看连带动作等进行摄像）',
            'lc_yd_dance' => '舞蹈症',
            'lc_yd_zhench' => '震颤',
            'lc_yd_jiz' => '肌张力障碍（镜像运动加强）',
            'lc_yd_shouz' => '手足徐动症',
            'lc_yd_koum' => '口面部运动障碍',
            'lc_sj_zhengz' => '精神病样症状（幻觉）',
            'lc_sj_yiyu' => '抑郁、焦虑',
            'lc_sj_renzhi' => '认知功能异常',
            'lc_sj_xinge' => '性格改变',
            'lc_else_butai' => '步态异常',
            'lc_else_yanyu' => '言语障碍（数数、发生：“哒、嗒、咔、噶”）',
            'lc_else_xiaon' => '小脑功能异常',
            'lc_else_xian' => '痫样发作病史',
            'lc_else_zhui' => '锥体束症状',
            'lc_else_gan' => '感觉异常/疼痛',
            'lc_else_wei' => '胃肠道症状',
            'lc_else_mi' => '泌尿系症状',
            'lc_else_jiz' => '肌阵挛',
        ];
    }

    public function defaultValue()
    {
        $this->lc_yd_parkinson = 0;
        $this->lc_yd_dance = 0;
        $this->lc_yd_zhench = 0;
        $this->lc_yd_jiz = 0;
        $this->lc_yd_shouz = 0;
        $this->lc_yd_koum = 0;
        $this->lc_sj_zhengz = 0;
        $this->lc_sj_yiyu = 0;
        $this->lc_sj_renzhi = 0;
        $this->lc_sj_xinge = 0;
        $this->lc_else_butai = 0;
        $this->lc_else_yanyu = 0;
        $this->lc_else_xiaon = 0;
        $this->lc_else_xian = 0;
        $this->lc_else_zhui = 0;
        $this->lc_else_gan = 0;
        $this->lc_else_wei = 0;
        $this->lc_else_mi = 0;
        $this->lc_else_jiz = 0;
    }

    public static function getParams($type = false, $code = false)
    {
        $params = [
            'jizhangli' => ['增高', '减退', '正常'],
            'jianfan' => ['0', '+', '++', '+++', '++++'],
            'yinyang' => ['阳性', '阴性'],
            'youwu' => ['1' => '有', '0' => '无'],
            'yizi' => ['不能', '尚可'],
            'xiazhi_zhen' => ['正常', '减退'],
            'zhibi' => ['稳准', '欠稳准'],
        ];

        if ($code !== false) {
            return ($type) ? $params[$type][$code] : '';
        }

        return ($type) ? $params[$type] : $params;
    }
}
